home *** CD-ROM | disk | FTP | other *** search
/ Great Canadian Scientists / GCS_CD.iso / mac / PC / GCSData / chromo_g.dxr / 00001_Main Scripts.ls next >
Encoding:
Text File  |  1996-09-01  |  4.2 KB  |  205 lines

  1. on startMovie
  2.   global BoxUp, NoQuiz, ChromosomePairing, rate, timer, Start
  3.   cursor(4)
  4.   set BoxUp to 0
  5.   set Start to 1
  6.   set timer to 0
  7.   resetField(the number of member "Number", 14, "bold", "Helvetica")
  8.   set the visible of sprite 11 to 0
  9.   movieinwindow()
  10.   put EMPTY into field "Number"
  11.   GameStart(ChromosomePairing)
  12.   if ChromosomePairing = 0 then
  13.     set ChromosomePairing to 0.10000000000000001
  14.   end if
  15.   set rate to 1
  16.   cursor(-1)
  17. end
  18.  
  19. on movieinwindow
  20.   global myWindow, point
  21.   if objectp(myWindow) then
  22.     forget(myWindow)
  23.   end if
  24.   DisectRect()
  25.   set horzOrigin to value(line 1 of point) + 14
  26.   set vertOrigin to value(line 2 of point) + 94
  27.   set myWindowRect to rect(horzOrigin, vertOrigin, horzOrigin + 593, vertOrigin + 355)
  28.   set myWindow to window "ActualGame"
  29.   set the rect of myWindow to myWindowRect
  30.   set the fileName of myWindow to "CHROMO_M.DIR"
  31.   set the titleVisible of myWindow to 0
  32.   set the visible of myWindow to 0
  33. end
  34.  
  35. on DisectRect
  36.   global point
  37.   set point to 0
  38.   put the rect of the stage into line 1 of Temp
  39.   set loop to 1
  40.   set Counter to 6
  41.   repeat with count = 1 to 4
  42.     put "0" into line count of point
  43.     repeat while (char Counter of line 1 of Temp <> ",") and (char Counter of line 1 of Temp <> ")")
  44.       put line count of point & char Counter of line 1 of Temp into line count of point
  45.       set Counter to Counter + 1
  46.       set loop to loop + 1
  47.     end repeat
  48.     set Counter to Counter + 2
  49.     set loop to 1
  50.   end repeat
  51. end
  52.  
  53. on stopMovie
  54.   global myWindow
  55.   forget(myWindow)
  56.   set timer to 0
  57.   sound stop 2
  58. end
  59.  
  60. on stop
  61.   global timer, myWindow, Start, NoQuiz, QuizWaiting
  62.   cursor(4)
  63.   set Start to 1
  64.   set timer to 0
  65.   tell myWindow
  66.     puppetSound(0)
  67.   end tell
  68.   tell myWindow
  69.     Cleanup()
  70.   end tell
  71.   close(myWindow)
  72.   set NoQuiz to 0
  73.   BStop(30, 34)
  74.   set the visible of sprite 11 to 0
  75.   updateStage()
  76.   go(2)
  77.   put EMPTY into field "Number"
  78.   if QuizWaiting = 1 then
  79.     PopQuiz()
  80.   end if
  81.   cursor(-1)
  82. end
  83.  
  84. on EndGame
  85.   global timer, myWindow, Start, rate
  86.   close(myWindow)
  87.   set Start to 1
  88.   set timer to 0
  89.   put "Done.  It took you " & WriteTime(11, rate) & ".  Your score is " & score() & "." into field "MsgBox"
  90.   put EMPTY into field "Number"
  91.   puppetSound("Win")
  92.   ShowBox()
  93. end
  94.  
  95. on score
  96.   global GameScore, ChromosomePairing, NumMatches, Wrong, rate, Difficulty
  97.   set GameScore to (435 * NumMatches) - (15 * time(11, rate)) - (Difficulty / 2 * 100 * Wrong)
  98.   if GameScore < 0 then
  99.     set GameScore to 0
  100.   end if
  101.   if GameScore > ChromosomePairing then
  102.     set ChromosomePairing to GameScore
  103.   end if
  104.   return GameScore
  105. end
  106.  
  107. on Help
  108.   global HelpMode, HelpTime, myWindow, timer
  109.   if the frame <= 2 then
  110.     set HelpMode to 1
  111.   end if
  112.   if the frame > 2 then
  113.     set timer to 0
  114.     set HelpMode to 0
  115.     HelpMovie(11)
  116.     set the visible of myWindow to 0
  117.   end if
  118.   puppetSound(0)
  119.   go("Help")
  120. end
  121.  
  122. on LeaveHelp
  123.   global HelpMode, HelpTime, myWindow, TimeStart, timer, rate
  124.   puppetSound(0)
  125.   if HelpMode = 1 then
  126.     go(2)
  127.   end if
  128.   if HelpMode = 0 then
  129.     go("Game")
  130.     set the visible of myWindow to 1
  131.     LeaveHelpMovie(11)
  132.     set timer to 1
  133.   end if
  134.   ClearTrackScripts()
  135.   cursor(-1)
  136. end
  137.  
  138. on OpenTime
  139.   global myWindow
  140.   open(myWindow)
  141. end
  142.  
  143. on ShowBox
  144.   global BoxUp, NoQuiz, QuizWaiting
  145.   if BoxUp = 0 then
  146.     set BoxUp to 1
  147.     BoxShow(22, 24)
  148.     BoxTrackScripts()
  149.     exit
  150.   end if
  151.   if BoxUp = 1 then
  152.     cursor(4)
  153.     set BoxUp to 0
  154.     BSuspend(24, 24)
  155.     BoxHide(22, 24)
  156.     ClearTrackScripts()
  157.     stop()
  158.     go(2)
  159.     ScoreDisplay()
  160.     cursor(-1)
  161.     if QuizWaiting = 1 then
  162.       PopQuiz()
  163.     end if
  164.   end if
  165. end
  166.  
  167. on KeyCheck
  168.   global BoxUp
  169.   if BoxUp = 1 then
  170.     if the key = RETURN then
  171.       ShowBox()
  172.     else
  173.       pass()
  174.     end if
  175.   end if
  176.   if BoxUp = 0 then
  177.     pass()
  178.   end if
  179. end
  180.  
  181. on ScientistScreen
  182.   cursor(4)
  183.   go(1, the pathName & "UCHIDA_S.DIR")
  184.   cursor(4)
  185. end
  186.  
  187. on HideInfoComplete
  188.   global timer, myWindow, rate
  189.   if the frame > 2 then
  190.     set the visible of myWindow to 1
  191.     set the movieRate of sprite 11 to rate
  192.     set timer to 1
  193.   end if
  194. end
  195.  
  196. on ShowInfoPrep
  197.   global timer, myWindow
  198.   if the frame > 2 then
  199.     set timer to 0
  200.     set the movieRate of sprite 11 to 0
  201.     set the visible of myWindow to 0
  202.   end if
  203.   return 1
  204. end
  205.